using System;
using System.Collections.Generic;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.Serialization;
using ns16;
using ns18;
using ns20;

namespace Newtonsoft.Json.Serialization
{
	public abstract class JsonContract
	{
		[CompilerGenerated]
		private sealed class Class84
		{
			public MethodInfo methodInfo_0;

			public void method_0(object object_0, StreamingContext streamingContext_0)
			{
				methodInfo_0.Invoke(object_0, new object[1] { streamingContext_0 });
			}
		}

		[CompilerGenerated]
		private sealed class Class85
		{
			public MethodInfo methodInfo_0;

			public void method_0(object object_0, StreamingContext streamingContext_0, ErrorContext errorContext_0)
			{
				methodInfo_0.Invoke(object_0, new object[2] { streamingContext_0, errorContext_0 });
			}
		}

		internal bool bool_0;

		internal bool bool_1;

		internal bool bool_2;

		internal bool bool_3;

		internal Type type_0;

		internal Enum14 enum14_0;

		internal Enum15 enum15_0;

		internal bool bool_4;

		internal bool bool_5;

		private List<SerializationCallback> list_0;

		private IList<SerializationCallback> ilist_0;

		private IList<SerializationCallback> ilist_1;

		private IList<SerializationCallback> ilist_2;

		private IList<SerializationErrorCallback> ilist_3;

		[CompilerGenerated]
		private Type type_1;

		[CompilerGenerated]
		private Type type_2;

		[CompilerGenerated]
		private bool? nullable_0;

		[CompilerGenerated]
		private JsonConverter jsonConverter_0;

		[CompilerGenerated]
		private JsonConverter jsonConverter_1;

		[CompilerGenerated]
		private Func<object> func_0;

		[CompilerGenerated]
		private bool bool_6;

		public Type UnderlyingType
		{
			[CompilerGenerated]
			get
			{
				return type_1;
			}
			[CompilerGenerated]
			private set
			{
				type_1 = value;
			}
		}

		public Type CreatedType
		{
			[CompilerGenerated]
			get
			{
				return type_2;
			}
			[CompilerGenerated]
			set
			{
				type_2 = value;
			}
		}

		public bool? IsReference
		{
			[CompilerGenerated]
			get
			{
				return nullable_0;
			}
			[CompilerGenerated]
			set
			{
				nullable_0 = value;
			}
		}

		public JsonConverter Converter
		{
			[CompilerGenerated]
			get
			{
				return jsonConverter_0;
			}
			[CompilerGenerated]
			set
			{
				jsonConverter_0 = value;
			}
		}

		internal JsonConverter JsonConverter_0
		{
			[CompilerGenerated]
			get
			{
				return jsonConverter_1;
			}
			[CompilerGenerated]
			set
			{
				jsonConverter_1 = value;
			}
		}

		public IList<SerializationCallback> OnDeserializedCallbacks
		{
			get
			{
				if (list_0 == null)
				{
					list_0 = new List<SerializationCallback>();
				}
				return list_0;
			}
		}

		public IList<SerializationCallback> OnDeserializingCallbacks
		{
			get
			{
				if (ilist_0 == null)
				{
					ilist_0 = new List<SerializationCallback>();
				}
				return ilist_0;
			}
		}

		public IList<SerializationCallback> OnSerializedCallbacks
		{
			get
			{
				if (ilist_1 == null)
				{
					ilist_1 = new List<SerializationCallback>();
				}
				return ilist_1;
			}
		}

		public IList<SerializationCallback> OnSerializingCallbacks
		{
			get
			{
				if (ilist_2 == null)
				{
					ilist_2 = new List<SerializationCallback>();
				}
				return ilist_2;
			}
		}

		public IList<SerializationErrorCallback> OnErrorCallbacks
		{
			get
			{
				if (ilist_3 == null)
				{
					ilist_3 = new List<SerializationErrorCallback>();
				}
				return ilist_3;
			}
		}

		[Obsolete("This property is obsolete and has been replaced by the OnDeserializedCallbacks collection.")]
		public MethodInfo OnDeserialized
		{
			get
			{
				if (OnDeserializedCallbacks.Count <= 0)
				{
					return null;
				}
				return OnDeserializedCallbacks[0].smethod_0();
			}
			set
			{
				OnDeserializedCallbacks.Clear();
				OnDeserializedCallbacks.Add(smethod_0(value));
			}
		}

		[Obsolete("This property is obsolete and has been replaced by the OnDeserializingCallbacks collection.")]
		public MethodInfo OnDeserializing
		{
			get
			{
				if (OnDeserializingCallbacks.Count <= 0)
				{
					return null;
				}
				return OnDeserializingCallbacks[0].smethod_0();
			}
			set
			{
				OnDeserializingCallbacks.Clear();
				OnDeserializingCallbacks.Add(smethod_0(value));
			}
		}

		[Obsolete("This property is obsolete and has been replaced by the OnSerializedCallbacks collection.")]
		public MethodInfo OnSerialized
		{
			get
			{
				if (OnSerializedCallbacks.Count <= 0)
				{
					return null;
				}
				return OnSerializedCallbacks[0].smethod_0();
			}
			set
			{
				OnSerializedCallbacks.Clear();
				OnSerializedCallbacks.Add(smethod_0(value));
			}
		}

		[Obsolete("This property is obsolete and has been replaced by the OnSerializingCallbacks collection.")]
		public MethodInfo OnSerializing
		{
			get
			{
				if (OnSerializingCallbacks.Count <= 0)
				{
					return null;
				}
				return OnSerializingCallbacks[0].smethod_0();
			}
			set
			{
				OnSerializingCallbacks.Clear();
				OnSerializingCallbacks.Add(smethod_0(value));
			}
		}

		[Obsolete("This property is obsolete and has been replaced by the OnErrorCallbacks collection.")]
		public MethodInfo OnError
		{
			get
			{
				if (OnErrorCallbacks.Count <= 0)
				{
					return null;
				}
				return OnErrorCallbacks[0].smethod_0();
			}
			set
			{
				OnErrorCallbacks.Clear();
				OnErrorCallbacks.Add(smethod_1(value));
			}
		}

		public Func<object> DefaultCreator
		{
			[CompilerGenerated]
			get
			{
				return func_0;
			}
			[CompilerGenerated]
			set
			{
				func_0 = value;
			}
		}

		public bool DefaultCreatorNonPublic
		{
			[CompilerGenerated]
			get
			{
				return bool_6;
			}
			[CompilerGenerated]
			set
			{
				bool_6 = value;
			}
		}

		internal JsonContract(Type underlyingType)
		{
			Class204.smethod_2(underlyingType, "underlyingType");
			UnderlyingType = underlyingType;
			bool_2 = underlyingType.smethod_9();
			bool_5 = !underlyingType.smethod_3() && !underlyingType.smethod_10();
			bool_0 = Class195.smethod_9(underlyingType);
			type_0 = ((!bool_0 || !Class195.smethod_10(underlyingType)) ? underlyingType : Nullable.GetUnderlyingType(underlyingType));
			CreatedType = type_0;
			bool_1 = Class182.smethod_3(type_0);
			bool_3 = type_0.smethod_7();
			if (type_0 == typeof(byte[]))
			{
				enum14_0 = Enum14.ReadAsBytes;
			}
			else if (type_0 == typeof(int))
			{
				enum14_0 = Enum14.ReadAsInt32;
			}
			else if (type_0 == typeof(decimal))
			{
				enum14_0 = Enum14.ReadAsDecimal;
			}
			else if (type_0 == typeof(string))
			{
				enum14_0 = Enum14.ReadAsString;
			}
			else if (type_0 == typeof(DateTime))
			{
				enum14_0 = Enum14.ReadAsDateTime;
			}
			else if (type_0 == typeof(DateTimeOffset))
			{
				enum14_0 = Enum14.ReadAsDateTimeOffset;
			}
			else
			{
				enum14_0 = Enum14.Read;
			}
		}

		internal void method_0(object object_0, StreamingContext streamingContext_0)
		{
			if (ilist_2 == null)
			{
				return;
			}
			foreach (SerializationCallback item in ilist_2)
			{
				item(object_0, streamingContext_0);
			}
		}

		internal void method_1(object object_0, StreamingContext streamingContext_0)
		{
			if (ilist_1 == null)
			{
				return;
			}
			foreach (SerializationCallback item in ilist_1)
			{
				item(object_0, streamingContext_0);
			}
		}

		internal void method_2(object object_0, StreamingContext streamingContext_0)
		{
			if (ilist_0 == null)
			{
				return;
			}
			foreach (SerializationCallback item in ilist_0)
			{
				item(object_0, streamingContext_0);
			}
		}

		internal void method_3(object object_0, StreamingContext streamingContext_0)
		{
			if (list_0 == null)
			{
				return;
			}
			foreach (SerializationCallback item in list_0)
			{
				item(object_0, streamingContext_0);
			}
		}

		internal void method_4(object object_0, StreamingContext streamingContext_0, ErrorContext errorContext_0)
		{
			if (ilist_3 == null)
			{
				return;
			}
			foreach (SerializationErrorCallback item in ilist_3)
			{
				item(object_0, streamingContext_0, errorContext_0);
			}
		}

		internal static SerializationCallback smethod_0(MethodInfo methodInfo_0)
		{
			return delegate(object object_0, StreamingContext streamingContext_0)
			{
				methodInfo_0.Invoke(object_0, new object[1] { streamingContext_0 });
			};
		}

		internal static SerializationErrorCallback smethod_1(MethodInfo methodInfo_0)
		{
			return delegate(object object_0, StreamingContext streamingContext_0, ErrorContext errorContext_0)
			{
				methodInfo_0.Invoke(object_0, new object[2] { streamingContext_0, errorContext_0 });
			};
		}
	}
}
